home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_cvs.idb / usr / freeware / info / cvs.info-4.z / cvs.info-4
Encoding:
GNU Info File  |  1999-04-16  |  47.0 KB  |  1,125 lines

  1. This is Info file cvs.info, produced by Makeinfo version 1.67 from the
  2. input file ./cvs.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * CVS: (cvs).          Concurrent Versions System
  6. END-INFO-DIR-ENTRY
  7.  
  8.    Copyright (C) 1992, 1993 Signum Support AB Copyright (C) 1993, 1994
  9. Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the entire resulting derived work is distributed under the terms
  18. of a permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that this permission notice may be stated in a
  23. translation approved by the Free Software Foundation.
  24.  
  25. 
  26. File: cvs.info,  Node: Informing others,  Next: Concurrency,  Prev: Conflicts example,  Up: Multiple developers
  27.  
  28. Informing others about commits
  29. ==============================
  30.  
  31.    It is often useful to inform others when you commit a new revision
  32. of a file.  The `-i' option of the `modules' file, or the `loginfo'
  33. file, can be used to automate this process.  *Note modules::.  *Note
  34. loginfo::.  You can use these features of CVS to, for instance,
  35. instruct CVS to mail a message to all developers, or post a message to
  36. a local newsgroup.
  37.  
  38. 
  39. File: cvs.info,  Node: Concurrency,  Next: Watches,  Prev: Informing others,  Up: Multiple developers
  40.  
  41. Several developers simultaneously attempting to run CVS
  42. =======================================================
  43.  
  44.    If several developers try to run CVS at the same time, one may get
  45. the following message:
  46.  
  47.      [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
  48.  
  49.    CVS will try again every 30 seconds, and either continue with the
  50. operation or print the message again, if it still needs to wait.  If a
  51. lock seems to stick around for an undue amount of time, find the person
  52. holding the lock and ask them about the cvs command they are running.
  53. If they aren't running a cvs command, look in the repository directory
  54. mentioned in the message and remove files which they own whose names
  55. start with `#cvs.rfl', `#cvs.wfl', or `#cvs.lock'.
  56.  
  57.    Note that these locks are to protect CVS's internal data structures
  58. and have no relationship to the word "lock" in the sense used by
  59. RCS--which refers to reserved checkouts (*note Multiple developers::.).
  60.  
  61.    Any number of people can be reading from a given repository at a
  62. time; only when someone is writing do the locks prevent other people
  63. from reading or writing.
  64.  
  65.    One might hope for the following property
  66.  
  67.      If someone commits some changes in one cvs command,
  68.      then an update by someone else will either get all the
  69.      changes, or none of them.
  70.  
  71.    but CVS does *not* have this property.  For example, given the files
  72.  
  73.      a/one.c
  74.      a/two.c
  75.      b/three.c
  76.      b/four.c
  77.  
  78.    if someone runs
  79.  
  80.      cvs ci a/two.c b/three.c
  81.  
  82.    and someone else runs `cvs update' at the same time, the person
  83. running `update' might get only the change to `b/three.c' and not the
  84. change to `a/two.c'.
  85.  
  86. 
  87. File: cvs.info,  Node: Watches,  Next: Choosing a model,  Prev: Concurrency,  Up: Multiple developers
  88.  
  89. Mechanisms to track who is editing files
  90. ========================================
  91.  
  92.    For many groups, use of CVS in its default mode is perfectly
  93. satisfactory.  Users may sometimes go to check in a modification only
  94. to find that another modification has intervened, but they deal with it
  95. and proceed with their check in.  Other groups prefer to be able to
  96. know who is editing what files, so that if two people try to edit the
  97. same file they can choose to talk about who is doing what when rather
  98. than be surprised at check in time.  The features in this section allow
  99. such coordination, while retaining the ability of two developers to
  100. edit the same file at the same time.
  101.  
  102.    For maximum benefit developers should use `cvs edit' (not `chmod')
  103. to make files read-write to edit them, and `cvs release' (not `rm') to
  104. discard a working directory which is no longer in use, but CVS is not
  105. able to enforce this behavior.
  106.  
  107. * Menu:
  108.  
  109. * Setting a watch::             Telling CVS to watch certain files
  110. * Getting Notified::            Telling CVS to notify you
  111. * Editing files::               How to edit a file which is being watched
  112. * Watch information::           Information about who is watching and editing
  113. * Watches Compatibility::       Watches interact poorly with CVS 1.6 or earlier
  114.  
  115. 
  116. File: cvs.info,  Node: Setting a watch,  Next: Getting Notified,  Up: Watches
  117.  
  118. Telling CVS to watch certain files
  119. ----------------------------------
  120.  
  121.    To enable the watch features, you first specify that certain files
  122. are to be watched.
  123.  
  124.  - Command: cvs watch on [`-lR'] FILES ...
  125.      Specify that developers should run `cvs edit' before editing
  126.      FILES.  CVS will create working copies of FILES read-only, to
  127.      remind developers to run the `cvs edit' command before working on
  128.      them.
  129.  
  130.      If FILES includes the name of a directory, CVS arranges to watch
  131.      all files added to the corresponding repository directory, and
  132.      sets a default for files added in the future; this allows the user
  133.      to set notification policies on a per-directory basis.  The
  134.      contents of the directory are processed recursively, unless the
  135.      `-l' option is given.  The `-R' option can be used to force
  136.      recursion if the `-l' option is set in `~/.cvsrc' (*note
  137.      ~/.cvsrc::.).
  138.  
  139.      If FILES is omitted, it defaults to the current directory.
  140.  
  141.  
  142.  - Command: cvs watch off [`-lR'] FILES ...
  143.      Do not provide notification about work on FILES.  CVS will create
  144.      working copies of FILES read-write.
  145.  
  146.      The FILES and options are processed as for `cvs watch on'.
  147.  
  148.  
  149. 
  150. File: cvs.info,  Node: Getting Notified,  Next: Editing files,  Prev: Setting a watch,  Up: Watches
  151.  
  152. Telling CVS to notify you
  153. -------------------------
  154.  
  155.    You can tell CVS that you want to receive notifications about
  156. various actions taken on a file.  You can do this without using `cvs
  157. watch on' for the file, but generally you will want to use `cvs watch
  158. on', so that developers use the `cvs edit' command.
  159.  
  160.  - Command: cvs watch add [`-a' ACTION] [`-lR'] FILES ...
  161.      Add the current user to the list of people to receive notification
  162.      of work done on FILES.
  163.  
  164.      The `-a' option specifies what kinds of events CVS should notify
  165.      the user about.  ACTION is one of the following:
  166.  
  167.     `edit'
  168.           Another user has applied the `cvs edit' command (described
  169.           below) to a file.
  170.  
  171.     `unedit'
  172.           Another user has applied the `cvs unedit' command (described
  173.           below) or the `cvs release' command to a file, or has deleted
  174.           the file and allowed `cvs update' to recreate it.
  175.  
  176.     `commit'
  177.           Another user has committed changes to a file.
  178.  
  179.     `all'
  180.           All of the above.
  181.  
  182.     `none'
  183.           None of the above.  (This is useful with `cvs edit',
  184.           described below.)
  185.  
  186.      The `-a' option may appear more than once, or not at all.  If
  187.      omitted, the action defaults to `all'.
  188.  
  189.      The FILES and options are processed as for the `cvs watch'
  190.      commands.
  191.  
  192.  
  193.  - Command: cvs watch remove [`-a' ACTION] [`-lR'] FILES ...
  194.      Remove a notification request established using `cvs watch add';
  195.      the arguments are the same.  If the `-a' option is present, only
  196.      watches for the specified actions are removed.
  197.  
  198.  
  199.    When the conditions exist for notification, CVS calls the `notify'
  200. administrative file.  Edit `notify' as one edits the other
  201. administrative files (*note Intro administrative files::.).  This file
  202. follows the usual conventions for administrative files (*note
  203. syntax::.), where each line is a regular expression followed by a
  204. command to execute.  The command should contain a single ocurrence of
  205. `%s' which will be replaced by the user to notify; the rest of the
  206. information regarding the notification will be supplied to the command
  207. on standard input.  The standard thing to put in the `notify' file is
  208. the single line:
  209.  
  210.      ALL mail %s -s \"CVS notification\"
  211.  
  212.    This causes users to be notified by electronic mail.
  213.  
  214.    Note that if you set this up in the straightforward way, users
  215. receive notifications on the server machine.  One could of course write
  216. a `notify' script which directed notifications elsewhere, but to make
  217. this easy, CVS allows you to associate a notification address for each
  218. user.  To do so create a file `users' in `CVSROOT' with a line for each
  219. user in the format USER:VALUE.  Then instead of passing the name of the
  220. user to be notified to `notify', CVS will pass the VALUE (normally an
  221. email address on some other machine).
  222.  
  223.    CVS does not notify you for your own changes.  Currently this check
  224. is done based on whether the user name of the person taking the action
  225. which triggers notification matches the user name of the person getting
  226. notification.  In fact, in general, the watches features only track one
  227. edit by each user.  It probably would be more useful if watches tracked
  228. each working directory separately, so this behavior might be worth
  229. changing.
  230.  
  231. 
  232. File: cvs.info,  Node: Editing files,  Next: Watch information,  Prev: Getting Notified,  Up: Watches
  233.  
  234. How to edit a file which is being watched
  235. -----------------------------------------
  236.  
  237.    Since a file which is being watched is checked out read-only, you
  238. cannot simply edit it.  To make it read-write, and inform others that
  239. you are planning to edit it, use the `cvs edit' command.  Some systems
  240. call this a "checkout", but CVS uses that term for obtaining a copy of
  241. the sources (*note Getting the source::.), an operation which those
  242. systems call a "get" or a "fetch".
  243.  
  244.  - Command: cvs edit [OPTIONS] FILES ...
  245.      Prepare to edit the working files FILES.  CVS makes the FILES
  246.      read-write, and notifies users who have requested `edit'
  247.      notification for any of FILES.
  248.  
  249.      The `cvs edit' command accepts the same OPTIONS as the `cvs watch
  250.      add' command, and establishes a temporary watch for the user on
  251.      FILES; CVS will remove the watch when FILES are `unedit'ed or
  252.      `commit'ted.  If the user does not wish to receive notifications,
  253.      she should specify `-a none'.
  254.  
  255.      The FILES and options are processed as for the `cvs watch'
  256.      commands.
  257.  
  258.      *Caution:* If the `PreservePermissions' option is enabled in the
  259.      repository (*note config::.), CVS will not change the permissions
  260.      on any of the FILES.  The reason for this change is to ensure that
  261.      using `cvs edit' does not interfere with the ability to store file
  262.      permissions in the CVS repository.
  263.  
  264.  
  265.    Normally when you are done with a set of changes, you use the `cvs
  266. commit' command, which checks in your changes and returns the watched
  267. files to their usual read-only state.  But if you instead decide to
  268. abandon your changes, or not to make any changes, you can use the `cvs
  269. unedit' command.
  270.  
  271.  - Command: cvs unedit [`-lR'] FILES ...
  272.      Abandon work on the working files FILES, and revert them to the
  273.      repository versions on which they are based.  CVS makes those
  274.      FILES read-only for which users have requested notification using
  275.      `cvs watch on'.  CVS notifies users who have requested `unedit'
  276.      notification for any of FILES.
  277.  
  278.      The FILES and options are processed as for the `cvs watch'
  279.      commands.
  280.  
  281.      If watches are not in use, the `unedit' command probably does not
  282.      work, and the way to revert to the repository version is to remove
  283.      the file and then use `cvs update' to get a new copy.  The meaning
  284.      is not precisely the same; removing and updating may also bring in
  285.      some changes which have been made in the repository since the last
  286.      time you updated.
  287.  
  288.    When using client/server CVS, you can use the `cvs edit' and `cvs
  289. unedit' commands even if CVS is unable to succesfully communicate with
  290. the server; the notifications will be sent upon the next successful CVS
  291. command.
  292.  
  293. 
  294. File: cvs.info,  Node: Watch information,  Next: Watches Compatibility,  Prev: Editing files,  Up: Watches
  295.  
  296. Information about who is watching and editing
  297. ---------------------------------------------
  298.  
  299.  - Command: cvs watchers [`-lR'] FILES ...
  300.      List the users currently watching changes to FILES.  The report
  301.      includes the files being watched, and the mail address of each
  302.      watcher.
  303.  
  304.      The FILES and options are processed as for the `cvs watch'
  305.      commands.
  306.  
  307.  
  308.  - Command: cvs editors [`-lR'] FILES ...
  309.      List the users currently working on FILES.  The report includes
  310.      the mail address of each user, the time when the user began
  311.      working with the file, and the host and path of the working
  312.      directory containing the file.
  313.  
  314.      The FILES and options are processed as for the `cvs watch'
  315.      commands.
  316.  
  317.  
  318. 
  319. File: cvs.info,  Node: Watches Compatibility,  Prev: Watch information,  Up: Watches
  320.  
  321. Using watches with old versions of CVS
  322. --------------------------------------
  323.  
  324.    If you use the watch features on a repository, it creates `CVS'
  325. directories in the repository and stores the information about watches
  326. in that directory.  If you attempt to use CVS 1.6 or earlier with the
  327. repository, you get an error message such as the following (all on one
  328. line):
  329.  
  330.      cvs update: cannot open CVS/Entries for reading:
  331.      No such file or directory
  332.  
  333.    and your operation will likely be aborted.  To use the watch
  334. features, you must upgrade all copies of CVS which use that repository
  335. in local or server mode.  If you cannot upgrade, use the `watch off' and
  336. `watch remove' commands to remove all watches, and that will restore
  337. the repository to a state which CVS 1.6 can cope with.
  338.  
  339. 
  340. File: cvs.info,  Node: Choosing a model,  Prev: Watches,  Up: Multiple developers
  341.  
  342. Choosing between reserved or unreserved checkouts
  343. =================================================
  344.  
  345.    Reserved and unreserved checkouts each have pros and cons.  Let it
  346. be said that a lot of this is a matter of opinion or what works given
  347. different groups' working styles, but here is a brief description of
  348. some of the issues.  There are many ways to organize a team of
  349. developers.  CVS does not try to enforce a certain organization.  It is
  350. a tool that can be used in several ways.
  351.  
  352.    Reserved checkouts can be very counter-productive.  If two persons
  353. want to edit different parts of a file, there may be no reason to
  354. prevent either of them from doing so.  Also, it is common for someone
  355. to take out a lock on a file, because they are planning to edit it, but
  356. then forget to release the lock.
  357.  
  358.    People, especially people who are familiar with reserved checkouts,
  359. often wonder how often conflicts occur if unreserved checkouts are
  360. used, and how difficult they are to resolve.  The experience with many
  361. groups is that they occur rarely and usually are relatively
  362. straightforward to resolve.
  363.  
  364.    The rarity of serious conflicts may be surprising, until one realizes
  365. that they occur only when two developers disagree on the proper design
  366. for a given section of code; such a disagreement suggests that the team
  367. has not been communicating properly in the first place.  In order to
  368. collaborate under *any* source management regimen, developers must
  369. agree on the general design of the system; given this agreement,
  370. overlapping changes are usually straightforward to merge.
  371.  
  372.    In some cases unreserved checkouts are clearly inappropriate.  If no
  373. merge tool exists for the kind of file you are managing (for example
  374. word processor files or files edited by Computer Aided Design
  375. programs), and it is not desirable to change to a program which uses a
  376. mergeable data format, then resolving conflicts is going to be
  377. unpleasant enough that you generally will be better off to simply avoid
  378. the conflicts instead, by using reserved checkouts.
  379.  
  380.    The watches features described above in *Note Watches:: can be
  381. considered to be an intermediate model between reserved checkouts and
  382. unreserved checkouts.  When you go to edit a file, it is possible to
  383. find out who else is editing it.  And rather than having the system
  384. simply forbid both people editing the file, it can tell you what the
  385. situation is and let you figure out whether it is a problem in that
  386. particular case or not.  Therefore, for some groups it can be
  387. considered the best of both the reserved checkout and unreserved
  388. checkout worlds.
  389.  
  390. 
  391. File: cvs.info,  Node: Revision management,  Next: Keyword substitution,  Prev: Multiple developers,  Up: Top
  392.  
  393. Revision management
  394. *******************
  395.  
  396.    If you have read this far, you probably have a pretty good grasp on
  397. what CVS can do for you.  This chapter talks a little about things that
  398. you still have to decide.
  399.  
  400.    If you are doing development on your own using CVS you could
  401. probably skip this chapter.  The questions this chapter takes up become
  402. more important when more than one person is working in a repository.
  403.  
  404. * Menu:
  405.  
  406. * When to commit::              Some discussion on the subject
  407.  
  408. 
  409. File: cvs.info,  Node: When to commit,  Up: Revision management
  410.  
  411. When to commit?
  412. ===============
  413.  
  414.    Your group should decide which policy to use regarding commits.
  415. Several policies are possible, and as your experience with CVS grows
  416. you will probably find out what works for you.
  417.  
  418.    If you commit files too quickly you might commit files that do not
  419. even compile.  If your partner updates his working sources to include
  420. your buggy file, he will be unable to compile the code.  On the other
  421. hand, other persons will not be able to benefit from the improvements
  422. you make to the code if you commit very seldom, and conflicts will
  423. probably be more common.
  424.  
  425.    It is common to only commit files after making sure that they can be
  426. compiled.  Some sites require that the files pass a test suite.
  427. Policies like this can be enforced using the commitinfo file (*note
  428. commitinfo::.), but you should think twice before you enforce such a
  429. convention.  By making the development environment too controlled it
  430. might become too regimented and thus counter-productive to the real
  431. goal, which is to get software written.
  432.  
  433. 
  434. File: cvs.info,  Node: Keyword substitution,  Next: Tracking sources,  Prev: Revision management,  Up: Top
  435.  
  436. Keyword substitution
  437. ********************
  438.  
  439.    As long as you edit source files inside your working copy of a
  440. module you can always find out the state of your files via `cvs status'
  441. and `cvs log'.  But as soon as you export the files from your
  442. development environment it becomes harder to identify which revisions
  443. they are.
  444.  
  445.    CVS can use a mechanism known as "keyword substitution" (or "keyword
  446. expansion") to help identifying the files.  Embedded strings of the form
  447. `$KEYWORD$' and `$KEYWORD:...$' in a file are replaced with strings of
  448. the form `$KEYWORD:VALUE$' whenever you obtain a new revision of the
  449. file.
  450.  
  451. * Menu:
  452.  
  453. * Keyword list::                Keywords
  454. * Using keywords::              Using keywords
  455. * Avoiding substitution::       Avoiding substitution
  456. * Substitution modes::          Substitution modes
  457. * Log keyword::                 Problems with the $Log$ keyword.
  458.  
  459. 
  460. File: cvs.info,  Node: Keyword list,  Next: Using keywords,  Up: Keyword substitution
  461.  
  462. Keyword List
  463. ============
  464.  
  465.    This is a list of the keywords:
  466.  
  467. `$Author$'
  468.      The login name of the user who checked in the revision.
  469.  
  470. `$Date$'
  471.      The date and time (UTC) the revision was checked in.
  472.  
  473. `$Header$'
  474.      A standard header containing the full pathname of the RCS file,
  475.      the revision number, the date (UTC), the author, the state, and
  476.      the locker (if locked).  Files will normally never be locked when
  477.      you use CVS.
  478.  
  479. `$Id$'
  480.      Same as `$Header$', except that the RCS filename is without a path.
  481.  
  482. `$Name$'
  483.      Tag name used to check out this file.
  484.  
  485. `$Locker$'
  486.      The login name of the user who locked the revision (empty if not
  487.      locked, and thus almost always useless when you are using CVS).
  488.  
  489. `$Log$'
  490.      The log message supplied during commit, preceded by a header
  491.      containing the RCS filename, the revision number, the author, and
  492.      the date (UTC).  Existing log messages are *not* replaced.
  493.      Instead, the new log message is inserted after `$Log:...$'.  Each
  494.      new line is prefixed with the same string which precedes the
  495.      `$Log' keyword.  For example, if the file contains
  496.  
  497.             /* Here is what people have been up to:
  498.              *
  499.              * $Log: frob.c,v $
  500.              * Revision 1.1  1997/01/03 14:23:51  joe
  501.              * Add the superfrobnicate option
  502.              *
  503.              */
  504.  
  505.      then additional lines which are added when expanding the `$Log'
  506.      keyword will be preceded by `   * '.  Unlike previous versions of
  507.      CVS and RCS, the "comment leader" from the RCS file is not used.
  508.      The `$Log' keyword is useful for accumulating a complete change
  509.      log in a source file, but for several reasons it can be
  510.      problematic.  *Note Log keyword::.
  511.  
  512. `$RCSfile$'
  513.      The name of the RCS file without a path.
  514.  
  515. `$Revision$'
  516.      The revision number assigned to the revision.
  517.  
  518. `$Source$'
  519.      The full pathname of the RCS file.
  520.  
  521. `$State$'
  522.      The state assigned to the revision.  States can be assigned with
  523.      `cvs admin -s'--see *Note admin options::.
  524.  
  525. 
  526. File: cvs.info,  Node: Using keywords,  Next: Avoiding substitution,  Prev: Keyword list,  Up: Keyword substitution
  527.  
  528. Using keywords
  529. ==============
  530.  
  531.    To include a keyword string you simply include the relevant text
  532. string, such as `$Id$', inside the file, and commit the file.  CVS will
  533. automatically expand the string as part of the commit operation.
  534.  
  535.    It is common to embed the `$Id$' string in the source files so that
  536. it gets passed through to generated files.  For example, if you are
  537. managing computer program source code, you might include a variable
  538. which is initialized to contain that string.  Or some C compilers may
  539. provide a `#pragma ident' directive.  Or a document management system
  540. might provide a way to pass a string through to generated files.
  541.  
  542.    The `ident' command (which is part of the RCS package) can be used
  543. to extract keywords and their values from a file.  This can be handy
  544. for text files, but it is even more useful for extracting keywords from
  545. binary files.
  546.  
  547.      $ ident samp.c
  548.      samp.c:
  549.           $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  550.      $ gcc samp.c
  551.      $ ident a.out
  552.      a.out:
  553.           $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  554.  
  555.    SCCS is another popular revision control system.  It has a command,
  556. `what', which is very similar to `ident' and used for the same purpose.
  557. Many sites without RCS have SCCS.  Since `what' looks for the
  558. character sequence `@(#)' it is easy to include keywords that are
  559. detected by either command.  Simply prefix the RCS keyword with the
  560. magic SCCS phrase, like this:
  561.  
  562.      static char *id="@(#) $Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
  563.  
  564. 
  565. File: cvs.info,  Node: Avoiding substitution,  Next: Substitution modes,  Prev: Using keywords,  Up: Keyword substitution
  566.  
  567. Avoiding substitution
  568. =====================
  569.  
  570.    Keyword substitution has its disadvantages.  Sometimes you might
  571. want the literal text string `$Author$' to appear inside a file without
  572. CVS interpreting it as a keyword and expanding it into something like
  573. `$Author: ceder $'.
  574.  
  575.    There is unfortunately no way to selectively turn off keyword
  576. substitution.  You can use `-ko' (*note Substitution modes::.) to turn
  577. off keyword substitution entirely.
  578.  
  579.    In many cases you can avoid using keywords in the source, even
  580. though they appear in the final product.  For example, the source for
  581. this manual contains `$@asis{}Author$' whenever the text `$Author$'
  582. should appear.  In `nroff' and `troff' you can embed the null-character
  583. `\&' inside the keyword for a similar effect.
  584.  
  585. 
  586. File: cvs.info,  Node: Substitution modes,  Next: Log keyword,  Prev: Avoiding substitution,  Up: Keyword substitution
  587.  
  588. Substitution modes
  589. ==================
  590.  
  591.    Each file has a stored default substitution mode, and each working
  592. directory copy of a file also has a substitution mode.  The former is
  593. set by the `-k' option to `cvs add' and `cvs admin'; the latter is set
  594. by the `-k' or `-A' options to `cvs checkout' or `cvs update'.  `cvs
  595. diff' also has a `-k' option.  For some examples, see *Note Binary
  596. files::.
  597.  
  598.    The modes available are:
  599.  
  600. `-kkv'
  601.      Generate keyword strings using the default form, e.g.  `$Revision:
  602.      5.7 $' for the `Revision' keyword.
  603.  
  604. `-kkvl'
  605.      Like `-kkv', except that a locker's name is always inserted if the
  606.      given revision is currently locked.  This option is normally not
  607.      useful when CVS is used.
  608.  
  609. `-kk'
  610.      Generate only keyword names in keyword strings; omit their values.
  611.      For example, for the `Revision' keyword, generate the string
  612.      `$Revision$' instead of `$Revision: 5.7 $'.  This option is useful
  613.      to ignore differences due to keyword substitution when comparing
  614.      different revisions of a file.
  615.  
  616. `-ko'
  617.      Generate the old keyword string, present in the working file just
  618.      before it was checked in.  For example, for the `Revision'
  619.      keyword, generate the string `$Revision: 1.1 $' instead of
  620.      `$Revision: 5.7 $' if that is how the string appeared when the
  621.      file was checked in.
  622.  
  623. `-kb'
  624.      Like `-ko', but also inhibit conversion of line endings between
  625.      the canonical form in which they are stored in the repository
  626.      (linefeed only), and the form appropriate to the operating system
  627.      in use on the client.  For systems, like unix, which use linefeed
  628.      only to terminate lines, this is the same as `-ko'.  For more
  629.      information on binary files, see *Note Binary files::.
  630.  
  631. `-kv'
  632.      Generate only keyword values for keyword strings.  For example,
  633.      for the `Revision' keyword, generate the string `5.7' instead of
  634.      `$Revision: 5.7 $'.  This can help generate files in programming
  635.      languages where it is hard to strip keyword delimiters like
  636.      `$Revision: $' from a string.  However, further keyword
  637.      substitution cannot be performed once the keyword names are
  638.      removed, so this option should be used with care.
  639.  
  640.      One often would like to use `-kv' with `cvs export'--*note
  641.      export::..  But be aware that doesn't handle an export containing
  642.      binary files correctly.
  643.  
  644. 
  645. File: cvs.info,  Node: Log keyword,  Prev: Substitution modes,  Up: Keyword substitution
  646.  
  647. Problems with the $Log$ keyword.
  648. ================================
  649.  
  650.    The `$Log$' keyword is somewhat controversial.  As long as you are
  651. working on your development system the information is easily accessible
  652. even if you do not use the `$Log$' keyword--just do a `cvs log'.  Once
  653. you export the file the history information might be useless anyhow.
  654.  
  655.    A more serious concern is that CVS is not good at handling `$Log$'
  656. entries when a branch is merged onto the main trunk.  Conflicts often
  657. result from the merging operation.
  658.  
  659.    People also tend to "fix" the log entries in the file (correcting
  660. spelling mistakes and maybe even factual errors).  If that is done the
  661. information from `cvs log' will not be consistent with the information
  662. inside the file.  This may or may not be a problem in real life.
  663.  
  664.    It has been suggested that the `$Log$' keyword should be inserted
  665. *last* in the file, and not in the files header, if it is to be used at
  666. all.  That way the long list of change messages will not interfere with
  667. everyday source file browsing.
  668.  
  669. 
  670. File: cvs.info,  Node: Tracking sources,  Next: Builds,  Prev: Keyword substitution,  Up: Top
  671.  
  672. Tracking third-party sources
  673. ****************************
  674.  
  675.    If you modify a program to better fit your site, you probably want
  676. to include your modifications when the next release of the program
  677. arrives.  CVS can help you with this task.
  678.  
  679.    In the terminology used in CVS, the supplier of the program is
  680. called a "vendor".  The unmodified distribution from the vendor is
  681. checked in on its own branch, the "vendor branch".  CVS reserves branch
  682. 1.1.1 for this use.
  683.  
  684.    When you modify the source and commit it, your revision will end up
  685. on the main trunk.  When a new release is made by the vendor, you
  686. commit it on the vendor branch and copy the modifications onto the main
  687. trunk.
  688.  
  689.    Use the `import' command to create and update the vendor branch.
  690. When you import a new file, the vendor branch is made the `head'
  691. revision, so anyone that checks out a copy of the file gets that
  692. revision.  When a local modification is committed it is placed on the
  693. main trunk, and made the `head' revision.
  694.  
  695. * Menu:
  696.  
  697. * First import::                Importing a module for the first time
  698. * Update imports::              Updating a module with the import command
  699. * Reverting local changes::     Reverting a module to the latest vendor release
  700. * Binary files in imports::     Binary files require special handling
  701. * Keywords in imports::         Keyword substitution might be undesirable
  702. * Multiple vendor branches::    What if you get sources from several places?
  703.  
  704. 
  705. File: cvs.info,  Node: First import,  Next: Update imports,  Up: Tracking sources
  706.  
  707. Importing a module for the first time
  708. =====================================
  709.  
  710.    Use the `import' command to check in the sources for the first time.
  711. When you use the `import' command to track third-party sources, the
  712. "vendor tag" and "release tags" are useful.  The "vendor tag" is a
  713. symbolic name for the branch (which is always 1.1.1, unless you use the
  714. `-b BRANCH' flag--*Note Multiple vendor branches::.).  The "release
  715. tags" are symbolic names for a particular release, such as `FSF_0_04'.
  716.  
  717.    Note that `import' does *not* change the directory in which you
  718. invoke it.  In particular, it does not set up that directory as a CVS
  719. working directory; if you want to work with the sources import them
  720. first and then check them out into a different directory (*note Getting
  721. the source::.).
  722.  
  723.    Suppose you have the sources to a program called `wdiff' in a
  724. directory `wdiff-0.04', and are going to make private modifications
  725. that you want to be able to use even when new releases are made in the
  726. future.  You start by importing the source to your repository:
  727.  
  728.      $ cd wdiff-0.04
  729.      $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
  730.  
  731.    The vendor tag is named `FSF_DIST' in the above example, and the
  732. only release tag assigned is `WDIFF_0_04'.
  733.  
  734. 
  735. File: cvs.info,  Node: Update imports,  Next: Reverting local changes,  Prev: First import,  Up: Tracking sources
  736.  
  737. Updating a module with the import command
  738. =========================================
  739.  
  740.    When a new release of the source arrives, you import it into the
  741. repository with the same `import' command that you used to set up the
  742. repository in the first place.  The only difference is that you specify
  743. a different release tag this time.
  744.  
  745.      $ tar xfz wdiff-0.05.tar.gz
  746.      $ cd wdiff-0.05
  747.      $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
  748.  
  749.    For files that have not been modified locally, the newly created
  750. revision becomes the head revision.  If you have made local changes,
  751. `import' will warn you that you must merge the changes into the main
  752. trunk, and tell you to use `checkout -j' to do so.
  753.  
  754.      $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
  755.  
  756. The above command will check out the latest revision of `wdiff',
  757. merging the changes made on the vendor branch `FSF_DIST' since
  758. yesterday into the working copy.  If any conflicts arise during the
  759. merge they should be resolved in the normal way (*note Conflicts
  760. example::.).  Then, the modified files may be committed.
  761.  
  762.    Using a date, as suggested above, assumes that you do not import
  763. more than one release of a product per day. If you do, you can always
  764. use something like this instead:
  765.  
  766.      $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
  767.  
  768. In this case, the two above commands are equivalent.
  769.  
  770. 
  771. File: cvs.info,  Node: Reverting local changes,  Next: Binary files in imports,  Prev: Update imports,  Up: Tracking sources
  772.  
  773. Reverting to the latest vendor release
  774. ======================================
  775.  
  776.    You can also revert local changes completely and return to the
  777. latest vendor release by changing the `head' revision back to the
  778. vendor branch on all files.  For example, if you have a checked-out
  779. copy of the sources in `~/work.d/wdiff', and you want to revert to the
  780. vendor's version for all the files in that directory, you would type:
  781.  
  782.      $ cd ~/work.d/wdiff
  783.      $ cvs admin -bWDIFF .
  784.  
  785. You must specify the `-bWDIFF' without any space after the `-b'.  *Note
  786. admin options::.
  787.  
  788. 
  789. File: cvs.info,  Node: Binary files in imports,  Next: Keywords in imports,  Prev: Reverting local changes,  Up: Tracking sources
  790.  
  791. How to handle binary files with cvs import
  792. ==========================================
  793.  
  794.    Use the `-k' wrapper option to tell import which files are binary.
  795. *Note Wrappers::.
  796.  
  797. 
  798. File: cvs.info,  Node: Keywords in imports,  Next: Multiple vendor branches,  Prev: Binary files in imports,  Up: Tracking sources
  799.  
  800. How to handle keyword substitution with cvs import
  801. ==================================================
  802.  
  803.    The sources which you are importing may contain keywords (*note
  804. Keyword substitution::.).  For example, the vendor may use CVS or some
  805. other system which uses similar keyword expansion syntax.  If you just
  806. import the files in the default fashion, then the keyword expansions
  807. supplied by the vendor will be replaced by keyword expansions supplied
  808. by your own copy of CVS.  It may be more convenient to maintain the
  809. expansions supplied by the vendor, so that this information can supply
  810. information about the sources that you imported from the vendor.
  811.  
  812.    To maintain the keyword expansions supplied by the vendor, supply
  813. the `-ko' option to `cvs import' the first time you import the file.
  814. This will turn off keyword expansion for that file entirely, so if you
  815. want to be more selective you'll have to think about what you want and
  816. use the `-k' option to `cvs update' or `cvs admin' as appropriate.
  817.  
  818. 
  819. File: cvs.info,  Node: Multiple vendor branches,  Prev: Keywords in imports,  Up: Tracking sources
  820.  
  821. Multiple vendor branches
  822. ========================
  823.  
  824.    All the examples so far assume that there is only one vendor from
  825. which you are getting sources.  In some situations you might get
  826. sources from a variety of places.  For example, suppose that you are
  827. dealing with a project where many different people and teams are
  828. modifying the software.  There are a variety of ways to handle this,
  829. but in some cases you have a bunch of source trees lying around and
  830. what you want to do more than anything else is just to all put them in
  831. CVS so that you at least have them in one place.
  832.  
  833.    For handling situations in which there may be more than one vendor,
  834. you may specify the `-b' option to `cvs import'.  It takes as an
  835. argument the vendor branch to import to.  The default is `-b 1.1.1'.
  836.  
  837.    For example, suppose that there are two teams, the red team and the
  838. blue team, that are sending you sources.  You want to import the red
  839. team's efforts to branch 1.1.1 and use the vendor tag RED.  You want to
  840. import the blue team's efforts to branch 1.1.3 and use the vendor tag
  841. BLUE.  So the commands you might use are:
  842.  
  843.      $ cvs import dir RED RED_1-0
  844.      $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
  845.  
  846.    Note that if your vendor tag does not match your `-b' option, CVS
  847. will not detect this case!  For example,
  848.  
  849.      $ cvs import -b 1.1.3 dir RED RED_1-0
  850.  
  851. Be careful; this kind of mismatch is sure to sow confusion or worse.  I
  852. can't think of a useful purpose for the ability to specify a mismatch
  853. here, but if you discover such a use, don't.  CVS is likely to make this
  854. an error in some future release.
  855.  
  856. 
  857. File: cvs.info,  Node: Builds,  Next: Special Files,  Prev: Tracking sources,  Up: Top
  858.  
  859. How your build system interacts with CVS
  860. ****************************************
  861.  
  862.    As mentioned in the introduction, CVS does not contain software for
  863. building your software from source code.  This section describes how
  864. various aspects of your build system might interact with CVS.
  865.  
  866.    One common question, especially from people who are accustomed to
  867. RCS, is how to make their build get an up to date copy of the sources.
  868. The answer to this with CVS is two-fold.  First of all, since CVS
  869. itself can recurse through directories, there is no need to modify your
  870. `Makefile' (or whatever configuration file your build tool uses) to
  871. make sure each file is up to date.  Instead, just use two commands,
  872. first `cvs -q update' and then `make' or whatever the command is to
  873. invoke your build tool.  Secondly, you do not necessarily *want* to get
  874. a copy of a change someone else made until you have finished your own
  875. work.  One suggested approach is to first update your sources, then
  876. implement, build and test the change you were thinking of, and then
  877. commit your sources (updating first if necessary).  By periodically (in
  878. between changes, using the approach just described) updating your
  879. entire tree, you ensure that your sources are sufficiently up to date.
  880.  
  881.    One common need is to record which versions of which source files
  882. went into a particular build.  This kind of functionality is sometimes
  883. called "bill of materials" or something similar.  The best way to do
  884. this with CVS is to use the `tag' command to record which versions went
  885. into a given build (*note Tags::.).
  886.  
  887.    Using CVS in the most straightforward manner possible, each
  888. developer will have a copy of the entire source tree which is used in a
  889. particular build.  If the source tree is small, or if developers are
  890. geographically dispersed, this is the preferred solution.  In fact one
  891. approach for larger projects is to break a project down into smaller
  892. separately-compiled subsystems, and arrange a way of releasing them
  893. internally so that each developer need check out only those subsystems
  894. which are they are actively working on.
  895.  
  896.    Another approach is to set up a structure which allows developers to
  897. have their own copies of some files, and for other files to access
  898. source files from a central location.  Many people have come up with
  899. some such a system using features such as the symbolic link feature
  900. found in many operating systems, or the `VPATH' feature found in many
  901. versions of `make'.  One build tool which is designed to help with this
  902. kind of thing is Odin (see
  903. `ftp://ftp.cs.colorado.edu/pub/distribs/odin').
  904.  
  905. 
  906. File: cvs.info,  Node: Special Files,  Next: CVS commands,  Prev: Builds,  Up: Top
  907.  
  908. Special Files
  909. *************
  910.  
  911.    In normal circumstances, CVS works only with regular files.  Every
  912. file in a project is assumed to be persistent; it must be possible to
  913. open, read and close them; and so on.  CVS also ignores file
  914. permissions and ownerships, leaving such issues to be resolved by the
  915. developer at installation time.  In other words, it is not possible to
  916. "check in" a device into a repository; if the device file cannot be
  917. opened, CVS will refuse to handle it.  Files also lose their ownerships
  918. and permissions during repository transactions.
  919.  
  920.    If the configuration variable `PreservePermissions' (*note
  921. config::.) is set in the repository, CVS will save the following file
  922. characteristics in the repository:
  923.  
  924.    * user and group ownership
  925.  
  926.    * permissions
  927.  
  928.    * major and minor device numbers
  929.  
  930.    * symbolic links
  931.  
  932.    * hard link structure
  933.  
  934.    Using the `PreservePermissions' option affects the behavior of CVS
  935. in several ways.  First, some of the new operations supported by CVS
  936. are not accessible to all users.  In particular, file ownership and
  937. special file characteristics may only be changed by the superuser.
  938. When the `PreservePermissions' configuration variable is set,
  939. therefore, users will have to be `root' in order to perform CVS
  940. operations.
  941.  
  942.    When `PreservePermissions' is in use, some CVS operations (such as
  943. `cvs status') will not recognize a file's hard link structure, and so
  944. will emit spurious warnings about mismatching hard links.  The reason
  945. is that CVS's internal structure does not make it easy for these
  946. operations to collect all the necessary data about hard links, so they
  947. check for file conflicts with inaccurate data.
  948.  
  949.    A more subtle difference is that CVS considers a file to have
  950. changed only if its contents have changed (specifically, if the
  951. modification time of the working file does not match that of the
  952. repository's file).  Therefore, if only the permissions, ownership or
  953. hard linkage have changed, or if a device's major or minor numbers have
  954. changed, CVS will not notice.  In order to commit such a change to the
  955. repository, you must force the commit with `cvs commit -f'.  This also
  956. means that if a file's permissions have changed and the repository file
  957. is newer than the working copy, performing `cvs update' will silently
  958. change the permissions on the working copy.
  959.  
  960.    Changing hard links in a CVS repository is particularly delicate.
  961. Suppose that file `foo' is linked to file `old', but is later relinked
  962. to file `new'.  You can wind up in the unusual situation where,
  963. although `foo', `old' and `new' have all had their underlying link
  964. patterns changed, only `foo' and `new' have been modified, so `old' is
  965. not considered a candidate for checking in.  It can be very easy to
  966. produce inconsistent results this way.  Therefore, we recommend that
  967. when it is important to save hard links in a repository, the prudent
  968. course of action is to `touch' any file whose linkage or status has
  969. changed since the last checkin.  Indeed, it may be wise to `touch *'
  970. before each commit in a directory with complex hard link structures.
  971.  
  972.    It is worth noting that only regular files may be merged, for
  973. reasons that hopefully are obvious.  If `cvs update' or `cvs checkout
  974. -j' attempts to merge a symbolic link with a regular file, or two
  975. device files for different kinds of devices, CVS will report a conflict
  976. and refuse to perform the merge.  At the same time, `cvs diff' will not
  977. report any differences between these files, since no meaningful textual
  978. comparisons can be made on files which contain no text.
  979.  
  980.    The `PreservePermissions' features do not work with client/server
  981. CVS.  Another limitation is that hard links must be to other files
  982. within the same directory; hard links across directories are not
  983. supported.
  984.  
  985. 
  986. File: cvs.info,  Node: CVS commands,  Next: Invoking CVS,  Prev: Special Files,  Up: Top
  987.  
  988. Guide to CVS commands
  989. *********************
  990.  
  991.    This appendix describes the overall structure of CVS commands, and
  992. describes some commands in detail (others are described elsewhere; for
  993. a quick reference to CVS commands, *note Invoking CVS::.).
  994.  
  995. * Menu:
  996.  
  997. * Structure::                   Overall structure of CVS commands
  998. * Exit status::                 Indicating CVS's success or failure
  999. * ~/.cvsrc::                    Default options with the ~/.csvrc file
  1000. * Global options::              Options you give to the left of cvs_command
  1001. * Common options::              Options you give to the right of cvs_command
  1002. * admin::                       Administration
  1003. * checkout::                    Checkout sources for editing
  1004. * commit::                      Check files into the repository
  1005. * diff::                        Show differences between revisions
  1006. * export::                      Export sources from CVS, similar to checkout
  1007. * history::                     Show status of files and users
  1008. * import::                      Import sources into CVS, using vendor branches
  1009. * log::                         Show log messages for files
  1010. * rdiff::                       'patch' format diffs between releases
  1011. * release::                     Indicate that a Module is no longer in use
  1012. * rtag::                        Add a tag to a module
  1013. * tag::                         Add a tag to checked out version
  1014. * update::                      Bring work tree in sync with repository
  1015.  
  1016. 
  1017. File: cvs.info,  Node: Structure,  Next: Exit status,  Up: CVS commands
  1018.  
  1019. Overall structure of CVS commands
  1020. =================================
  1021.  
  1022.    The overall format of all CVS commands is:
  1023.  
  1024.      cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
  1025.  
  1026. `cvs'
  1027.      The name of the CVS program.
  1028.  
  1029. `cvs_options'
  1030.      Some options that affect all sub-commands of CVS.  These are
  1031.      described below.
  1032.  
  1033. `cvs_command'
  1034.      One of several different sub-commands.  Some of the commands have
  1035.      aliases that can be used instead; those aliases are noted in the
  1036.      reference manual for that command.  There are only two situations
  1037.      where you may omit `cvs_command': `cvs -H' elicits a list of
  1038.      available commands, and `cvs -v' displays version information on
  1039.      CVS itself.
  1040.  
  1041. `command_options'
  1042.      Options that are specific for the command.
  1043.  
  1044. `command_args'
  1045.      Arguments to the commands.
  1046.  
  1047.    There is unfortunately some confusion between `cvs_options' and
  1048. `command_options'.  `-l', when given as a `cvs_option', only affects
  1049. some of the commands.  When it is given as a `command_option' is has a
  1050. different meaning, and is accepted by more commands.  In other words,
  1051. do not take the above categorization too seriously.  Look at the
  1052. documentation instead.
  1053.  
  1054. 
  1055. File: cvs.info,  Node: Exit status,  Next: ~/.cvsrc,  Prev: Structure,  Up: CVS commands
  1056.  
  1057. CVS's exit status
  1058. =================
  1059.  
  1060.    CVS can indicate to the calling environment whether it succeeded or
  1061. failed by setting its "exit status".  The exact way of testing the exit
  1062. status will vary from one operating system to another.  For example in
  1063. a unix shell script the `$?' variable will be 0 if the last command
  1064. returned a successful exit status, or greater than 0 if the exit status
  1065. indicated failure.
  1066.  
  1067.    If CVS is successful, it returns a successful status; if there is an
  1068. error, it prints an error message and returns a failure status.  The
  1069. one exception to this is the `cvs diff' command.  It will return a
  1070. successful status if it found no differences, or a failure status if
  1071. there were differences or if there was an error.  Because this behavior
  1072. provides no good way to detect errors, in the future it is possible that
  1073. `cvs diff' will be changed to behave like the other CVS commands.
  1074.  
  1075. 
  1076. File: cvs.info,  Node: ~/.cvsrc,  Next: Global options,  Prev: Exit status,  Up: CVS commands
  1077.  
  1078. Default options and the ~/.cvsrc file
  1079. =====================================
  1080.  
  1081.    There are some `command_options' that are used so often that you
  1082. might have set up an alias or some other means to make sure you always
  1083. specify that option.  One example (the one that drove the
  1084. implementation of the `.cvsrc' support, actually) is that many people
  1085. find the default output of the `diff' command to be very hard to read,
  1086. and that either context diffs or unidiffs are much easier to understand.
  1087.  
  1088.    The `~/.cvsrc' file is a way that you can add default options to
  1089. `cvs_commands' within cvs, instead of relying on aliases or other shell
  1090. scripts.
  1091.  
  1092.    The format of the `~/.cvsrc' file is simple.  The file is searched
  1093. for a line that begins with the same name as the `cvs_command' being
  1094. executed.  If a match is found, then the remainder of the line is split
  1095. up (at whitespace characters) into separate options and added to the
  1096. command arguments *before* any options from the command line.
  1097.  
  1098.    If a command has two names (e.g., `checkout' and `co'), the official
  1099. name, not necessarily the one used on the command line, will be used to
  1100. match against the file.  So if this is the contents of the user's
  1101. `~/.cvsrc' file:
  1102.  
  1103.      log -N
  1104.      diff -u
  1105.      update -P
  1106.      checkout -P
  1107.  
  1108. the command `cvs checkout foo' would have the `-P' option added to the
  1109. arguments, as well as `cvs co foo'.
  1110.  
  1111.    With the example file above, the output from `cvs diff foobar' will
  1112. be in unidiff format.  `cvs diff -c foobar' will provide context diffs,
  1113. as usual.  Getting "old" format diffs would be slightly more
  1114. complicated, because `diff' doesn't have an option to specify use of
  1115. the "old" format, so you would need `cvs -f diff foobar'.
  1116.  
  1117.    In place of the command name you can use `cvs' to specify global
  1118. options (*note Global options::.).  For example the following line in
  1119. `.cvsrc'
  1120.  
  1121.      cvs -z6
  1122.  
  1123.    causes CVS to use compression level 6.
  1124.  
  1125.